//
// Created by wxd on 2025/9/17.
// 聚光灯
//

#ifndef SPOTLIGHT_H
#define SPOTLIGHT_H

#include "Light.h"
#include "../glFramework/demo/obj/Object.h"
#include "glm/glm.hpp"
#include <string>

class SpotLight : public Light, public Object {
public:

    static std::string uSpotLightCol;
    static std::string uSpotLightPos;
    static std::string uSpotLightFovRange;
    static std::string uSpotLightCenterDir;

    SpotLight() {
        mLightType = LightType::Spot;
    }

    SpotLight(float inn, float out, glm::vec3 centerDir) {
        mCenterDir = centerDir;
        mInnerFov = inn;
        mOuterFov = out;
        mLightType = LightType::Spot;
    }

    LightType getType() const override { return LightType::Spot; }

    std::unique_ptr<ILight> clone() const override {
        return std::make_unique<SpotLight>(*this);
    }

    void setCenterDir(glm::vec3 dir) {
        mCenterDir = dir;
    }

    void setInnerFov(float fov) {
        mInnerFov = fov;
    }

    void setOuterFov(float fov) {
        mOuterFov = fov;
    }

    glm::vec3 getCenterDir() const {
        return mCenterDir;
    }

    float getInnerFov() const {
        return mInnerFov;
    }

    float getOuterFov() const {
        return mOuterFov;
    }

    void setFovRange(float inner, float outer) {
        mInnerFov = inner;
        mOuterFov = outer;
    }

    glm::vec2 getFovRange() const {
        return glm::vec2(glm::radians(mInnerFov), glm::radians(mOuterFov));
    }

private:
    // 传入的是角度，给到着色器的时候转化为弧度
    float mInnerFov { 0.f };
    float mOuterFov { 0.f };
    glm::vec3 mCenterDir { glm::vec3(0.f) };
};



#endif //SPOTLIGHT_H
